package Part1_泛型的使用;

import java.util.Objects;

/**
 * ClassName: Person
 * Package: IntelliJ IDEA
 * Description:
 * Written by HanXu
 * Create 2024.04.17 23:32
 */
public class Person {
    String name;
    BirthDay birth;

    public Person() {
    }

    public Person(String name, BirthDay birth) {
        this.name = name;
        this.birth = birth;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public BirthDay getBirth() {
        return birth;
    }

    public void setBirth(BirthDay birth) {
        this.birth = birth;
    }

    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", birth=" + birth +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof Person person)) return false;
        return Objects.equals(name, person.name) && Objects.equals(birth, person.birth);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, birth);
    }
}
